package com.koomii.demo.tk.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.koomii.demo.tk.entity.User;
import com.koomii.demo.tk.service.UserService;

@Controller
@RequestMapping("/user")
public class UserController {
	@Autowired
	UserService userService;
	
	@RequestMapping("/getAll")
	@ResponseBody
	public List<User> getAll(){
		return userService.findAll();
	}
	
	@RequestMapping("/insert")
	@ResponseBody
	public Integer insert(User user){
		return userService.insert(user);
	}
	
	@RequestMapping("/update")
	@ResponseBody
	public Integer update(User user){
		return userService.update(user);
	}
}
